home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 9 / Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO / 050a / snr53b.zip / VARIABLE.S < prev    next >
Text File  |  1993-05-30  |  6KB  |  138 lines

  1. \  VARIABLE.S
  2. \  This table contains a collection of unrelated
  3. \  variable-length search-and-replace equations
  4. \  for EXAMPLE purposes.
  5.  
  6. \  This table will run VERY slowly, because we are using
  7. \  equations with first-character wild cards in addition to the
  8. \  variable-length search-and-replace.
  9.  
  10. \  In normal practice, you'll use only one of these sample equation
  11. \  patterns in a table. That will speed things up.
  12.  
  13. \ ***************************************************************************
  14.  
  15. \  This equation puts a special code in front of a line in which the first
  16. \  three words are capitalized. The limit for a "word" is up to 15
  17. \  characters. The literal reading of this equation is:
  18.  
  19. \  any printable character + up to 15 upper case letters terminated by a 
  20. \  space + up to 15 upper case letters terminated by a space + up to 15 
  21. \  upper case letters terminated by a space + up to 80 printable characters 
  22. \  terminated by a CR-LF = [CAP LINE] + the first character of the line + 
  23. \  word 1 + a space + word 2 + a space + word 3 + a space + rest of line + 
  24. \  a CR-LF
  25.  
  26. \v\^*(15)\u \^*(15)\u \^*(15)\u \^*(80)\v\0d\0a=            \+ continued...
  27. [CAP LINE]\p0\^1 \^2 \^3 \^4\0d\0a
  28.  
  29. \ ***************************************************************************
  30.  
  31. \  This equation will scan a line for the presence of leader dots and then
  32. \  put a code in front a line that contains them. The literal reading of
  33. \  this equation is:
  34.  
  35. \  any printable character + up to 80 printable characters terminated by 
  36. \  four periods + up to 80 more printable characters terminated by a CR-LF 
  37. \  = [LEADERED LINE] + the first character of the line + the first 
  38. \  variable-length string + four periods + the second variable-length 
  39. \  string + a CR-LF
  40.  
  41. \v\^*(80)\v....\^*(80)\v\0d\0a=[LEADERED LINE]\p0\^1....\^2\0d\0a
  42.  
  43. \  You could change the effect of the equation by changing the four periods
  44. \  to some other literal text, such as the word "CHAPTER" or a question mark
  45. \  or anything you choose. Try it.
  46.  
  47. \ ***************************************************************************
  48.  
  49. \  This equation will put a special code in front of a line that is preceded
  50. \  and followed by blank lines. The literal reading of this equation is:
  51.  
  52. \  two CR-LFs + up to 100 printable characters terminated by two CR-LFs 
  53. \  = two CR-LFs + [SINGLE LINE] + the first variable-length string + two 
  54. \  CR-LFs
  55.  
  56. \0d\0a\0d\0a\^*(100)\v\0d\0a\0d\0a=\0d\0a\0d\0a[SINGLE LINE]\^1\0d\0a\0d\0a
  57.  
  58. \ ***************************************************************************
  59.  
  60. \  This equation will swap the order of 5 variable-length columns which are
  61. \  separated by ASCII tab codes (hex 09). The literal reading of this equation
  62. \  is:
  63.  
  64. \  any printable character + up to 40 printable characters terminated by 
  65. \  a tab + up to 40 printable characters terminated by a tab + up to 40 
  66. \  printable characters terminated by a tab + up to 40 printable characters 
  67. \  terminated by a tab + up to 40 printable characters terminated by a 
  68. \  CR-LF = the second variable-length string + tab + the fourth 
  69. \  variable-length string + tab + the first character of the line + the 
  70. \  first variable-length string + tab + the fifth variable-length string + 
  71. \  tab + the third variable-length string + CR-LF
  72.  
  73. \v\^*(40)\v\09\^*(40)\v\09\^*(40)\v\09\^*(40)\v\09\^*(40)\v\0d\0a=  \+ cont.
  74. \^2\09\^4\09\p0\^1\09\^5\09\^3\0d\0a
  75.  
  76. \ ***************************************************************************
  77.  
  78. \  IMPORTANT NOTE: All of the above equations happen to use the CR-LF
  79. \  terminator. It is NOT a requirement in SNR that variable-length
  80. \  equations end in CR-LF! Any literal character string that suits your
  81. \  purpose is allowed as a terminator. Here's an example:
  82.  
  83. [\^*(20)\v]=
  84.  
  85. \  The equation reads:
  86. \  a left bracket + up to 20 printable characters terminated by a
  87. \  right bracket = nothing
  88.  
  89. \ ***************************************************************************
  90.  
  91. \  The following equation will scan for the presence of a city, state, zip
  92. \  sequence of characters and mark the line appropriately. The literal
  93. \  reading of this equation is:
  94.  
  95. \  an upper case letter + up to 40 characters terminated by a comma + up 
  96. \  to 20 spaces terminated by 2 upper case letters + up to 20 spaces 
  97. \  terminated by 5 numbers = [city] + the first character + variable-length 
  98. \  string 1 + variable-length string 2 + [state] + variable-length string 
  99. \  2's terminator + variable-length string 3 + [zip] + variable-length 
  100. \  string 3's terminator
  101.  
  102.  
  103. \u\^*(40)\v,\^*(20) \u\u\^*(20) \n\n\n\n\n=     \+ continued
  104. [city]\p0\^1,\^2[state]\^:2\^3[zip]\^:3
  105.  
  106. \  The next equation does basically the same thing, except for Canadian
  107. \  city, province, country. Zips are of the form A1B2C3.
  108.  
  109. \u\^*(30)\v \^*(30)\v\^*(20) Can\^*(5)\v\^*(20) \u\n\u\n\u\n=     \+ continued
  110. [city/province]\p0\^1\^:1\^2\^3[country]\^:3\^4\^5[zip]\^:5
  111.  
  112. \ (Same as preceding, except zips are of the form A1B 2C3)
  113. \u\^*(30)\v \^*(30)\v\^*(20) Can\^*(5)\v\^*(20) \u\n\u \n\u\n=     \+ continued
  114. [city/province]\p0\^1\^:1\^2\^3[country]\^:3\^4\^5[zip]\^:5
  115.  
  116. \ ***************************************************************************
  117.  
  118. \  The following equations will swap the order of two arguments in a couple
  119. \  of 'C' language function calls. You programmers out there -- pay
  120. \  attention! You can use this technique for ANY language whose functions or
  121. \  subroutines require arguments.
  122.  
  123. \  This first example turns an fputs() function into a puts() function by
  124. \  renaming the function and keeping only the second argument
  125.  
  126. fputs(\^*(20)\v,\^*(20)\v)=puts(\^2)
  127.  
  128. \  This second example swaps the order of the two arguments in a stpcpy()
  129. \  function and renames it to strcpy() at the same time
  130.  
  131. stpcpy(\^*(20)\v,\^*(20)\v)=strcpy(\^2,\^1)
  132.  
  133. \  You probably won't ever need to swap the order of arguments in such
  134. \  common functions as fputs and stpcpy, but it's a handy technique to know.
  135.  
  136. \ ***************************************************************************
  137.  
  138.